import type { App } from 'vue'
import { useUserStore } from '../stores/user'

export const regPermission = (app: App<Element>) => {
  app.directive('permission', {
    mounted(el, binging) {
      const store = useUserStore()

      if (!store.auth.includes(binging.value)) {
        el.remove()
      }
    }
  })
}
